﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBControl;

namespace ProjectX
{
    public partial class MsgWeb : Errorbase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                
                if (Session["userNick"] != null)
                {
                    this.username.Text = Session["userNick"].ToString();
                    this.loginlink.Visible = false;
                    this.reglink.Visible = false;
                    this.logout.Visible = true;
                    //SqlDbHelper sdh = new SqlDbHelper();
                    //string getover = "SELECT TOP 1 Overtime FROM BuyersinfoR WHERE ReleaseName = '" + Session["userNick"] + "' AND [Status] = 0 ORDER BY overtime DESC";
                    //string time = sdh.ExecuteScalar(getover).ToString();
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "getovertime", "<script>getovertime('" + time + "')</script>", false);
                }
            }
        }

        protected void logout_Click(object sender, EventArgs e)
        {
            Session.Clear();
            Response.Write("<script language='javascript'>window.parent.location.href='/'</script>");
        }
    }
}